package LambadaDemo;

import java.util.Comparator;
import java.util.PriorityQueue;

interface C{
    void test();
    default  void dome(){

    }
    public static  void test2(){

    }
}
//无返回值无参数
@FunctionalInterface
interface  NoParameterNoReturn{
    void test();
}
//无返回值一个参数
@FunctionalInterface
interface  OneParameterNoReturn{
    void  test(double a);
}
//无返回值多个参数
@FunctionalInterface
interface  TwoParameterNoReturn{
    void test(double a,double b);
}
//有返回值无参数
@FunctionalInterface
interface  NoParameterReturn{
    int test();
}
//有返回值一个参数
@FunctionalInterface
interface   OneParameterReturn{
    double test(double c);
}
//有返回值多参数
@FunctionalInterface
interface  MoreParameterReturn{
    double test(double c,int d);
}
public class Test {
    public static void main(String[] args) {
        int a = 9;
        //a = 10;
        PriorityQueue<Integer> priorityQueue = new PriorityQueue<>(new Comparator<Integer>() {
            @Override
            public int compare(Integer o1, Integer o2) {
                System.out.println(a);
                return o1.compareTo(o2);
            }
        }) ;
        PriorityQueue<Integer> priorityQueue1 = new PriorityQueue<>(( o1,o2)->o1.compareTo(o2));

    }
    public static void main6(String[] args) {
        MoreParameterReturn moreParameterReturn = (double c,int d)->99.9;
        System.out.println(moreParameterReturn.test(9,10));
    }
    public static void main5(String[] args) {
        OneParameterReturn oneParameterReturn = (c)->29.9;
        System.out.println(oneParameterReturn.test(9.9));
    }
    public static void main4(String[] args) {
        //NoParameterReturn noParameterReturn = ()->{return 9;};
        NoParameterReturn noParameterReturn = ()->9;
        System.out.println(noParameterReturn.test());
    }
    public static void main3(String[] args) {
        TwoParameterNoReturn twoParameterNoReturn = (double a,double b)-> System.out.println(a/b);
        twoParameterNoReturn.test(9,2);
    }
    public static void main2(String[] args) {
       // OneParameterNoReturn oneParameterNoReturn = (double a)->{
           // System.out.println(a);
        //};
        OneParameterNoReturn oneParameterNoReturn = (double a)-> System.out.println(a);
        oneParameterNoReturn.test(9.9);

    }
    public static void main1(String[] args) {
        NoParameterNoReturn noParameterNoReturn = new NoParameterNoReturn() {
            @Override
            public void test() {
                System.out.println("新的test方法，被我重写了");
            }
        };
        System.out.println("=====");
        NoParameterNoReturn noParameterNoReturn1 = ()-> System.out.println("新的test方法，被我重写了");
    }
}
